home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-138 < prev    next >
Text File  |  1996-03-23  |  52KB  |  1,428 lines

  1. C.S.M.P. Digest             Wed, 28 Feb 96       Volume 3 : Issue 138
  2.  
  3. Today's Topics:
  4.  
  5.         Can't sync up to VBL...
  6.         Confused about MDEF!
  7.         CopyBits, SetGWorld, and Everything (tm)
  8.         Drag & Drop and Trash
  9.         Drag Manager: How to have custom clippings
  10.         Idle time
  11.         KanjiTalk ignores GNEFilters?
  12.         [ANN] GC 4.9 for MacOS
  13.         [ANN] Visit Mac Games Programmers' Bitstop!
  14.  
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  18. (pottier@clipper.ens.fr).
  19.  
  20. The digest is a collection of article threads from the internet
  21. newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
  22. csmp.games. It is designed for people who read news semi-regularly and
  23. want an archive of the discussions.  If you don't know what a
  24. newsgroup is, you probably don't have access to it. Ask your systems
  25. administrator(s) for details. If you don't have access to news, you
  26. may still be able to post messages to the group by using a mail server
  27. like anon.penet.fi (mail help@anon.penet.fi for more information).
  28.  
  29. Each issue of the digest contains one or more sets of articles (called
  30. threads), with each set corresponding to a 'discussion' of a particular
  31. subject.  The articles are not edited; all articles included in this digest
  32. are in their original posted form (as received by our news server at
  33. nef.ens.fr).  Article threads are not added to the digest until the last
  34. article added to the thread is at least two weeks old (this is to ensure that
  35. the thread is dead before adding it to the digest).  Article threads that
  36. consist of only one message are generally not included in the digest.
  37.  
  38. The digest is officially distributed by two means, by email and ftp.
  39.  
  40. If you want to receive the digest by mail, send email to listserv@ens.fr
  41. with no subject and one of the following commands as body:
  42.     help                        Sends you a summary of commands
  43.     subscribe csmp-digest Your Name    Adds you to the mailing list
  44.     signoff csmp-digest            Removes you from the list
  45. Once you have subscribed, you will automatically receive each new
  46. issue as it is created.
  47.  
  48. The official ftp info is ftp://ftp.dartmouth.edu/pub/csmp-digest.
  49. Questions related to the ftp site should be directed to
  50. scott.silver@dartmouth.edu.
  51.  
  52. -------------------------------------------------------
  53.  
  54. >From Mikael <mikael@resus.univ-mrs.fr>
  55. Subject: Can't sync up to VBL...
  56. Date: 10 Feb 1996 23:57:11 GMT
  57. Organization: Association Resus
  58.  
  59. Hi all.
  60.  
  61.   Here is my problem:
  62.  I've been trying to sync up my code to the VBL of the screen and so far, I've
  63. succeeded only on one of my friend's 630. But on my 7200, it just won't work...
  64.  What I'm doing is to use SlotVInstall after finding out the slot number of my
  65. screen, and giving it a pointer to my procedure, the one that is to be called
  66. for each of the screen's VBL. It'works just fine on the 630, but it seems that
  67. I'm missing something about the way you give a ProcPtr to the system on a
  68. Powermac... (note that it doesn't even work when trying to do that with the
  69. vanilla 60 Hz VBL queue). All I have as a documentation is a 1992 version of
  70. Think Reference, and it doesn't explain what changed in the system with the
  71. Powermac (obviously... the powermac didn't exist at that time...). I've been
  72. peeking in CodeWarrior's header files to try to figure it out, but I don't know
  73. anything about the different flavors of UPP's, and I just can't get the system
  74. to call my procs without crashing.
  75.  
  76.  Think Reference also explains how you should save and restore the A5 register
  77. to allow your proc to acces your application's global variables, but I don't
  78. know how you fit that to the powermac...
  79.  
  80.  And last thing, I've also been trying to play real-time generated sound using
  81. SndPlayDoubleBuffer. But here again, I can't pass the informations about my
  82. callback procedure to the system in a working way (here, the first buffer plays
  83. well and then the whole thing crashes when the system tries to call my proc).
  84.  
  85.  
  86.  I hope someone can help me on these ones because I think I won't figure them
  87. out on my own...
  88.  
  89.  Thanks in advance.
  90.  
  91.        Mikael Bouillot (mikael@resus.univ-mrs.fr)
  92.  
  93.  
  94. +++++++++++++++++++++++++++
  95.  
  96. >From John Burch
  97. Date: 11 Feb 1996 22:31:29 GMT
  98. Organization: ProAccess Systems Inc.
  99.  
  100. In article <4fjbcn$39n@bias.ipc.uni-tuebingen.de>, mikael@resus.univ-mrs.fr says...
  101. >
  102. >Hi all.
  103. >
  104. >  Here is my problem:
  105. > I've been trying to sync up my code to the VBL of the screen and so far, I've
  106. >succeeded only on one of my friend's 630. But on my 7200, it just won't work...
  107. > What I'm doing is to use SlotVInstall after finding out the slot number of my
  108. >screen, and giving it a pointer to my procedure, the one that is to be called
  109. >for each of the screen's VBL. It'works just fine on the 630, but it seems that
  110. >I'm missing something about the way you give a ProcPtr to the system on a
  111. >Powermac... (note that it doesn't even work when trying to do that with the
  112. >vanilla 60 Hz VBL queue). All I have as a documentation is a 1992 version of
  113. >Think Reference, and it doesn't explain what changed in the system with the
  114. >Powermac (obviously... the powermac didn't exist at that time...). I've been
  115. >peeking in CodeWarrior's header files to try to figure it out, but I don't know
  116. >anything about the different flavors of UPP's, and I just can't get the system
  117. >to call my procs without crashing.
  118. >
  119. > Think Reference also explains how you should save and restore the A5 register
  120. >to allow your proc to acces your application's global variables, but I don't
  121. >know how you fit that to the powermac...
  122. >
  123. > And last thing, I've also been trying to play real-time generated sound using
  124. >SndPlayDoubleBuffer. But here again, I can't pass the informations about my
  125. >callback procedure to the system in a working way (here, the first buffer plays
  126. >well and then the whole thing crashes when the system tries to call my proc).
  127. >
  128. >
  129. > I hope someone can help me on these ones because I think I won't figure them
  130. >out on my own...
  131. >
  132. > Thanks in advance.
  133. >
  134. >       Mikael Bouillot (mikael@resus.univ-mrs.fr)
  135. >
  136.  
  137.  
  138. Mikael,
  139. This code works fine on a 7100 PPC - it's standard code from Apple I think. 
  140. Maybe there's a problem with the code that
  141. is called by the VBL. Hope it helps.
  142.  
  143.  
  144. OSErr InstallVBL ()
  145. {
  146. long    anErr;
  147. Str255    Temp;
  148. short    MainSlotNumber,  mainDeviceRefNum;
  149.  
  150.  
  151.     gMyVBLRec.myVBLTask.qType = vType;
  152.     gMyVBLRec.myVBLTask.vblAddr = (ProcPtr) DoVBL;// address of task  
  153.     gMyVBLRec.myVBLTask.vblCount = kInterval; // Set the interval  
  154.     gMyVBLRec.vblA5 = (long) CurrentA5; // Save app's A5 in structure  
  155.  
  156.     mainDeviceRefNum = (**GetMainDevice()).gdRefNum;
  157.     MainSlotNumber = (**(AuxDCEHandle)GetDCtlEntry(mainDeviceRefNum)).dCtlSlot;
  158.     
  159.     anErr = SlotVInstall ((QElemPtr) &gMyVBLRec.myVBLTask, MainSlotNumber);
  160.     
  161.     return anErr;    
  162. }
  163.  
  164. void DoVBL()
  165. {
  166.     long    curA5;
  167.     VBLRecPtr    recPtr;
  168.  
  169.     recPtr = (VBLRecPtr) GetVBLRec ();
  170.     curA5 = SetA5 (recPtr->vblA5);// read app A5 from structure and save  
  171.             // current value of A5  
  172.     // ...  now that it's OK to access application variables, do the task ...  
  173.     
  174.     fastDraw(recPtr);
  175.  
  176.      // Reset vblCount so that this procedure executes again  
  177.     recPtr->myVBLTask.vblCount = kInterval;
  178.     curA5 = SetA5(curA5);
  179. }
  180.  
  181.  
  182. John 
  183.  
  184.  
  185. +++++++++++++++++++++++++++
  186.  
  187. >From henry_van_tunen@mindlink.bc.ca (Henry van Tunen)
  188. Date: 12 Feb 1996 06:15:23 GMT
  189. Organization: Motionworks Group Limited
  190.  
  191. In article <4fjbcn$39n@bias.ipc.uni-tuebingen.de>, Mikael
  192. <mikael@resus.univ-mrs.fr> wrote:
  193.  
  194. > Hi all.
  195. >   Here is my problem:
  196. >  I've been trying to sync up my code to the VBL of the screen and so far, I've
  197. > succeeded only on one of my friend's 630. But on my 7200, it just won't
  198. work...
  199. >  What I'm doing is to use SlotVInstall after finding out the slot number of my
  200. > screen, and giving it a pointer to my procedure, the one that is to be called
  201. > for each of the screen's VBL. It'works just fine on the 630, but it seems that
  202. > I'm missing something about the way you give a ProcPtr to the system on a
  203. > Powermac... (note that it doesn't even work when trying to do that with the
  204. > vanilla 60 Hz VBL queue). All I have as a documentation is a 1992 version of
  205. > Think Reference, and it doesn't explain what changed in the system with the
  206. > Powermac (obviously... the powermac didn't exist at that time...). I've been
  207. > peeking in CodeWarrior's header files to try to figure it out, but I
  208. don't know
  209. > anything about the different flavors of UPP's, and I just can't get the system
  210. > to call my procs without crashing.
  211. >  Think Reference also explains how you should save and restore the A5 register
  212. > to allow your proc to acces your application's global variables, but I don't
  213. > know how you fit that to the powermac...
  214.  
  215. Hi Mikael,
  216.  
  217. I can answer the VBL stuff... The following code will set a flag that
  218. your main program loop can test to see if it is time to draw. The flag
  219. gets set in a VBL task (you can't do much else there since VBL's can't
  220. move memory). This code will work for 68K, 68K CFM, and PowerPC.
  221.  
  222. typedef struct MyVBL
  223. {
  224.   VBLTask  vbl;
  225.   Boolean  timeToDraw;
  226. } MyVBL;
  227.  
  228. MyVBL gVBL;
  229.  
  230. void StartVBL( void )
  231. {
  232.   gVBL.vbl.qType    = vType;
  233.   gVBL.vbl.vblAddr  = NewVBLProc( MyVBLTask );
  234.   gVBL.vbl.vblCount = 1;
  235.   gVBL.vbl.vblPhase = 0;
  236.   gVBL.timeToDraw   = false;
  237.  
  238.   SlotVInstall( ( QElemPtr ) &gVBL, gTheSlot );
  239. }
  240.  
  241. #if GENERATINGCFM
  242.   pascal void MyVBLTask( VBLTaskPtr pVBL )
  243. #else
  244.   #pragma parameter MyVBLTask( __A0 )
  245.   pascal void MyVBLTask( VBLTaskPtr pVBL )
  246. #endif
  247. {
  248.    MyVBL*   pMyVBL = ( MyVBL* ) pVBL;
  249.  
  250.    pVBL.vbl.vblCount = 1;        // keep VBL alive
  251.    pVBL.timeToDraw = true;       // it's time to draw
  252. }
  253.  
  254. In you idle loop you can check "gVBL.timeToDraw" to see if you should
  255. update your window. Eg:
  256.  
  257. void MyIdle( void )
  258. {
  259.   gVBL.timeToDraw = false;       // wait for next retrace
  260.   while( ! gVBL.timeToDraw )
  261.     ;
  262.   CopyBits( ... );               // draw everything
  263.  
  264. }
  265.  
  266. Hope this helps,
  267. -- 
  268. Hank van Tunen
  269. Senior Geek - Motion Works Group Limited.
  270. hankvt@mwg.com
  271.  
  272. +++++++++++++++++++++++++++
  273.  
  274. >From bwade@qualia.com (Bretton Wade)
  275. Date: Tue, 13 Feb 1996 11:26:44 -0500
  276. Organization: qualia, inc.
  277.  
  278. In article <4fjbcn$39n@bias.ipc.uni-tuebingen.de>, Mikael
  279. <mikael@resus.univ-mrs.fr> wrote:
  280.  
  281. #  Think Reference also explains how you should save and restore the A5 register
  282. # to allow your proc to acces your application's global variables, but I don't
  283. # know how you fit that to the powermac...
  284.  
  285. you don't need to do this on a PowerMac, also, be sure you are using the
  286. macro to generate a callback record... it looks like this (this is
  287. butchered out of my own code, so forgive if I missed something):
  288.  
  289. //-----------------------------------------------------------------
  290. int         gTick = 0;
  291. VBLTask     gVBLTask;
  292.  
  293. //-----------------------------------------------------------------
  294. pascal   void  MyDoVBL (VBLTaskPtr rec)
  295. {
  296.    gTick++;
  297.    rec->vblCount = 1;
  298. }
  299.  
  300. //-----------------------------------------------------------------
  301. void     InstallVBL (void)
  302. {
  303.    GDHandle device = GetMainDevice ();
  304.    int   slotNum = 
  305.       (* AuxDCEHandle (GetDCtlEntry((*device)->gdRefNum)))->dCtlSlot;
  306.    gVBLTask.qType = vType;
  307.    gVBLTask.vblAddr = NewVBLProc (MyDoVBL);
  308.    gVBLTask.vblCount = 1;
  309.    gVBLTask.vblPhase = 0;
  310.    SlotVInstall ((QElemPtr) &gVBLTask, slotNum);
  311. }
  312.  
  313. //-----------------------------------------------------------------
  314.  
  315. -- 
  316. bwade@qualia.com
  317. http://www.qualia.com/
  318.  
  319. ---------------------------
  320.  
  321. >From Hugh Kawahara <kawahara@leland.stanford.edu>
  322. Subject: Confused about MDEF!
  323. Date: 11 Feb 1996 07:40:38 GMT
  324. Organization: Stanford Univ.
  325.  
  326. Hi all! It's late Saturday evening.
  327. Recently, I wrote a custom menu def. resource MDEF.
  328. I intended to use it as a pop-up menu.
  329. The program starts like
  330.   pascal void main(short message, MenuHandle theMenu,
  331.                                Rect *menuRect, Point hitPt, short *whichItem).
  332. When the MDEF receives "mPopUpMsg" in the "message" parameter,
  333. the "hitPt" parameter is supposed to contain the top-left coordinate
  334. of the pop-up box. (This is almost a excerption from IM).
  335. But my MDEF drew the menu at a wrong position.
  336. I scratched my head for a while, then I swapped the hitPt.h and hitPt.v,
  337. i.e. I used the hitPt.h as the top and hitPt.v as the left coordinate.
  338. Surprisingly, it fixed the problem.
  339. What did I do wrong this time?
  340.  
  341. Also, IM doesn't say anything about "mDrawItemMsg" and "mCalcItemMsg".
  342. I was fortunate enough to find it out.
  343. But, how can you find these "hidden" informations?
  344.  
  345. Hugh
  346.  
  347.  
  348.  
  349.  
  350.  
  351. +++++++++++++++++++++++++++
  352.  
  353. >From hawkfish@punchdeck.com (Richard Wesley)
  354. Date: Mon, 12 Feb 1996 10:01:32 -0800
  355. Organization: Punch Deck Consulting
  356.  
  357. In article <4fk6hm$s56@nntp.Stanford.EDU>, Hugh Kawahara
  358. <kawahara@leland.stanford.edu> wrote:
  359.  
  360. >Hi all! It's late Saturday evening.
  361. >Recently, I wrote a custom menu def. resource MDEF.
  362. >I intended to use it as a pop-up menu.
  363. >The program starts like
  364. >  pascal void main(short message, MenuHandle theMenu,
  365. >                                               Rect *menuRect, Point
  366. hitPt, short *whichItem).
  367. >When the MDEF receives "mPopUpMsg" in the "message" parameter,
  368. >the "hitPt" parameter is supposed to contain the top-left coordinate
  369. >of the pop-up box. (This is almost a excerption from IM).
  370. >But my MDEF drew the menu at a wrong position.
  371. >I scratched my head for a while, then I swapped the hitPt.h and hitPt.v,
  372. >i.e. I used the hitPt.h as the top and hitPt.v as the left coordinate.
  373. >Surprisingly, it fixed the problem.
  374. >What did I do wrong this time?
  375. >
  376. >Also, IM doesn't say anything about "mDrawItemMsg" and "mCalcItemMsg".
  377. >I was fortunate enough to find it out.
  378. >But, how can you find these "hidden" informations?
  379.  
  380. This is a known bug.  I forget where its documented, but its one of those
  381. things that they couldn't change, so we're all stuck with remembering
  382. it...
  383.  
  384.  
  385. - rmgw
  386.  
  387. http://www.punchdeck.com/hawkfish/PunchDeck.html
  388.  
  389. - --------------------------------------------------------------------------
  390. Richard Wesley             | "I don't know about your dreams
  391. hawkfish@punchdeck.com     |  But mine are sort of hackneyed"
  392. hawkfish@electricfish.com  |   - Laurie Anderson, "Talk Normal"
  393. - --------------------------------------------------------------------------
  394.  
  395. +++++++++++++++++++++++++++
  396.  
  397. >From lorenw@rwp.mv.com (Loren Wright)
  398. Date: Tue, 13 Feb 1996 15:35:51 GMT
  399. Organization: Roger Wagner Publishing
  400.  
  401. > In article <4fk6hm$s56@nntp.Stanford.EDU>, Hugh Kawahara
  402. > <kawahara@leland.stanford.edu> wrote:
  403.  
  404. > >Also, IM doesn't say anything about "mDrawItemMsg" and "mCalcItemMsg".
  405. > >I was fortunate enough to find it out.
  406. > >But, how can you find these "hidden" informations?
  407.  
  408. I make a habit of looking at the header files.  Sometimes they have stuff
  409. that's either missing or unclear from IM.
  410.  
  411. +++++++++++++++++++++++++++
  412.  
  413. >From gurgle@apple.com (Pete Gontier)
  414. Date: Tue, 13 Feb 1996 14:10:29 -0800
  415. Organization: Apple Computer, Inc.
  416.  
  417. In article <4fk6hm$s56@nntp.Stanford.EDU>,
  418. Hugh Kawahara <kawahara@leland.stanford.edu> wrote:
  419.  
  420.  > Also, IM doesn't say anything about "mDrawItemMsg" and "mCalcItemMsg".
  421.  > I was fortunate enough to find it out.
  422.  > But, how can you find these "hidden" informations?
  423.  
  424. These messages are only generated by the System 7 Popup CDEF.  If you are
  425. handling popup menus yourself, then your MDEF need not worry about these
  426. messages, because the Menu Manager will never generate them.
  427.  
  428. If you are using, or plan to use, the popup CDEF, then you should handle
  429. these messages.  Unfortunately, we have never released sample code to do
  430. this, but it shouldn't be too hard.
  431.  
  432. The MDEF gets called the same way for both messages:
  433.  
  434. The message parameter is the message.
  435.  
  436. The theMenu parameter is the MenuHandle.
  437.  
  438. The menuRect parameter is the Rect to draw in.  For mCalcItemMsg, this
  439. will be an empty Rect and should be filled in by the MDEF.  For
  440. mDrawItemMsg it will be the Rect to draw in.
  441.  
  442. The hitPt parameter is just the topLeft for the Rect.
  443.  
  444. The whichItem parameter is the item to display.
  445.  
  446. The only thing that looks tricky about mCalcItemMsg is that the first
  447. thing it does is call _CalcMenuSize.  It calls _CalcMenuSize rather then
  448. calling its internal function to do the same thing because the popup CDEF
  449. installs a mini-MDEF that overrides to result of the mSizeMsg calculation
  450. to adjust for the extra width of the downward pointing arrow.  If you
  451. bypass that then the menu won't be sized correctly.
  452.  
  453. mDrawItemMsg simply calls through to the same code that draws individual
  454. items for the menu itself.
  455.  
  456. - ---------
  457.  
  458.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  459.  
  460.   work      mail  <mailto:gurgle@apple.com>
  461.   personal  mail  <mailto:gurgle@ccnet.com>
  462.   personal  web   <http://www.ccnet.com/~gurgle>
  463.   work      web   <http://dev.info.apple.com/dts.html>
  464.  
  465. ---------------------------
  466.  
  467. >From chad@pengar.com (Chad Leigh @ The Electronic GunShop)
  468. Subject: CopyBits, SetGWorld, and Everything (tm)
  469. Date: Tue, 06 Feb 1996 03:05:42 -0700
  470. Organization: Pengar Enterprises, Inc.
  471.  
  472.  
  473. Hi All
  474.  
  475. I have a quick question:
  476.  
  477. I whipped up a quick program over the weekend and ran into some questions.
  478.  
  479. My program has 3 offscreen GWorlds and a Window for final display.  I
  480. develoepd it on a PPC using MW CW 8.0 (straight C).  I compiled both PPC
  481. and 68K versions and both ran fine on the PPC (7.5.2).
  482.  
  483. I moved the 68K version to my brothers IIsi (7.1) and it didn't work right
  484. in some places.
  485.  
  486. The program uses CopyBits from the GWorlds to other Gworlds and to the
  487. Window on-screen.
  488.  
  489. That is the background.
  490.  
  491. Now the questions:
  492.  
  493. 1.  Is it necessary to do a SetGWorld to the *destination*
  494. Gworld/CGrafport before doing the CopyBits?     NIM:ImagQDraw (IQD) seems
  495. to imply that you need to do this. (at least for the window).  Looking at
  496. the examples in NIM:IQD they do this.  But after having troubles on the
  497. IIsi, and then looking at example code, like in the "Tricks of the Mac
  498. Game Programming Gurus", they do lots of CopyBits without ever Setting any
  499. port (equivalent) that I could tell.  Looking at various example in
  500. different places, some do it and some don't.
  501.  
  502. After setting the gworld (SetGWorld) my code now works on the IIsi (it
  503. always worked on the PPC).  (I do some simple animations as pieces move on
  504. a field and the piece on the PPC would move nicely in a slide to its next
  505. position -- on the IIsi it would hesitate for a second and then jump to
  506. its new position. (The hesitation was the "sliding" loop but it didn't
  507. show up on the screen.  Now it all works on both machines).
  508.  
  509.  
  510. 2.  LockPixels() -- NIM says that you need to do this before doing a
  511. CopyBits into or from a GWorld (NIM:IQD 6-9 -- 4th paragraph down).  Lots
  512. of examples don't.  I always have but after seeing others not I am
  513. wondering?
  514.  
  515. Is setting the NoPurge (default) flag in the NewGWorld call enough to not
  516. have to do this?  I ask because NIM:IQD does NOT make this qualification
  517. and also because maybe there is a technical difference between "purging
  518. (out of memory)" and merely "moving" the base address.
  519.  
  520. +++++++++++++++++++++++++++
  521.  
  522. >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU>
  523. Date: Tue,  6 Feb 1996 12:02:56 -0500
  524. Organization: Carnegie Mellon, Pittsburgh, PA
  525.  
  526. chad@pengar.com (Chad Leigh @ The Electronic GunShop) writes:
  527. > I whipped up a quick program over the weekend and ran into some questions.
  528. > My program has 3 offscreen GWorlds and a Window for final display.  I
  529. > develoepd it on a PPC using MW CW 8.0 (straight C).  I compiled both PPC
  530. > and 68K versions and both ran fine on the PPC (7.5.2).
  531. > I moved the 68K version to my brothers IIsi (7.1) and it didn't work right
  532. > in some places.
  533. > The program uses CopyBits from the GWorlds to other Gworlds and to the
  534. > Window on-screen.
  535. > That is the background.
  536. > Now the questions:
  537. > 1.  Is it necessary to do a SetGWorld to the *destination*
  538. > Gworld/CGrafport before doing the CopyBits?     NIM:ImagQDraw (IQD) seems
  539. > to imply that you need to do this. (at least for the window).  Looking at
  540. > the examples in NIM:IQD they do this.  But after having troubles on the
  541. > IIsi, and then looking at example code, like in the "Tricks of the Mac
  542. > Game Programming Gurus", they do lots of CopyBits without ever Setting any
  543. > port (equivalent) that I could tell.  Looking at various example in
  544. > different places, some do it and some don't.
  545.  
  546. Yes, it is necessary. If the destination of the CopyBits has a
  547. graphics device which is different from the one which is currently set
  548. by SetGWorld(), you can get color or speed problems.
  549.  
  550. > 2.  LockPixels() -- NIM says that you need to do this before doing a
  551. > CopyBits into or from a GWorld (NIM:IQD 6-9 -- 4th paragraph down).  Lots
  552. > of examples don't.  I always have but after seeing others not I am
  553. > wondering?
  554.  
  555. It's like locking any other handle. Maybe you can get away with not
  556. locking it before you use it. Then one day you (or your user) finds a
  557. sequence of actions which causes a memory allocation, and suddenly
  558. you're writing to an invalid pointer. Crash bang.
  559.  
  560. > Is setting the NoPurge (default) flag in the NewGWorld call enough to not
  561. > have to do this?  I ask because NIM:IQD does NOT make this qualification
  562. > and also because maybe there is a technical difference between "purging
  563. > (out of memory)" and merely "moving" the base address.
  564.  
  565. No. There *is* a difference between purging a handle and leaving it
  566. unlocked. You pretty much stated it: if it's got the nopurge flag, it
  567. will never actually be deleted, but it still may be moved, unless you
  568. LockPixels() it.
  569.  
  570. --Z
  571.  
  572. "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
  573.  
  574. +++++++++++++++++++++++++++
  575.  
  576. >From MMMGuild@aol.com (Bill Catambay)
  577. Date: Tue, 06 Feb 1996 09:28:59 -0800
  578. Organization: Marathon Map Makers Guild
  579.  
  580. In article <chad-0602960305420001@sverige.pengar.com>, chad@pengar.com
  581. (Chad Leigh @ The Electronic GunShop) wrote:
  582.  
  583. > Hi All
  584. > I have a quick question:
  585. > 1.  Is it necessary to do a SetGWorld to the *destination*
  586. > Gworld/CGrafport before doing the CopyBits? 
  587.  
  588. Yes, you need to SetGWorld to destination GWorld, and/or SetPort to
  589. destination GrafPort.
  590.  
  591. > 2.  LockPixels() -- NIM says that you need to do this before doing a
  592. > CopyBits into or from a GWorld (NIM:IQD 6-9 -- 4th paragraph down).  Lots
  593. > of examples don't.  I always have but after seeing others not I am
  594. > wondering?
  595.  
  596. With GWorlds, yes, you should lock the pixels.  You have to do this
  597. because a GWorld actually holds its pixel map in a handle rather than a
  598. pointer. LockPixels makes sure the pixel map doesn't move. You should lock
  599. a GWorld's pixels before drawing to or copying from the GWorld (and unlock
  600. them afterward).
  601.  
  602. _____________________________________________________________________
  603. Bill Catambay
  604. Pascal Programmer on Macintosh and Open VMS
  605.  
  606.               />
  607.              //   The purpose of software engineering  
  608.      (//////[O]>=========================================-
  609.              \\    is to manage complexity, not to create it.
  610.               \>
  611.  
  612. ____________________________________________________________________
  613. Marathon lovers: Check out Devil in a Blue Dress, a 20-level custom map scenario with new story and plots.
  614.  
  615. +++++++++++++++++++++++++++
  616.  
  617. >From phixus@deltanet.com (Chris De Salvo)
  618. Date: Tue, 06 Feb 1996 21:44:38 -0800
  619. Organization: MacPlay
  620.  
  621. In article <chad-0602960305420001@sverige.pengar.com>, chad@pengar.com
  622. (Chad Leigh @ The Electronic GunShop) wrote:
  623.  
  624. >1.  Is it necessary to do a SetGWorld to the *destination*
  625. >Gworld/CGrafport before doing the CopyBits?     NIM:ImagQDraw (IQD) seems
  626. >to imply that you need to do this. (at least for the window).  Looking at
  627. >the examples in NIM:IQD they do this.  But after having troubles on the
  628. >IIsi, and then looking at example code, like in the "Tricks of the Mac
  629. >Game Programming Gurus", they do lots of CopyBits without ever Setting any
  630. >port (equivalent) that I could tell.  Looking at various example in
  631. >different places, some do it and some don't.
  632.  
  633.    CopyBits() uses the current grafport (in this case a GWorld) to
  634. determine clipping and other such info when transfering bits.  As such,
  635. you should do a SetGWorld() to the destination before blitting.
  636.  
  637. >2.  LockPixels() -- NIM says that you need to do this before doing a
  638. >CopyBits into or from a GWorld (NIM:IQD 6-9 -- 4th paragraph down).  Lots
  639. >of examples don't.  I always have but after seeing others not I am
  640. >wondering?
  641. >
  642. >Is setting the NoPurge (default) flag in the NewGWorld call enough to not
  643. >have to do this?  I ask because NIM:IQD does NOT make this qualification
  644. >and also because maybe there is a technical difference between "purging
  645. >(out of memory)" and merely "moving" the base address.
  646.  
  647.    My feeling on this is that since the pixels are held in a handle-based
  648. data structure, they could be relocated in RAM during a Memory Manager
  649. operation.  CopyBits() could cause memory to be moved.  Who knows when
  650. this could happen.  The NoPurge flag will keep them from being cleared
  651. from RAM, but won't stop them from moving.  It would be bad for the bits
  652. to move in the middle of a blit.  I would recommend having your pixels
  653. locked.
  654.  
  655. If those three GWorlds aren't being resized or anything during the life of
  656. your program, just lock them right after you allocate them, and unlock
  657. before you free them.  That way you don't have to worry about them. 
  658. Assuming that you do this early on in your program, they should be in a
  659. friendly place in the heap.
  660.  
  661. L8R
  662. Chris
  663.  
  664. -- 
  665. phixus@deltanet.com         |   Macintosh:  Changing the world,
  666. Chris De Salvo              |        one person at a time!
  667. Professional Mac Geek       |    -----------------------------
  668. for MacPlay, Inc.           |      (I wish they'd hurry up!)
  669.  
  670.            http://www.deltanet.com/users/phixus
  671.  
  672. +++++++++++++++++++++++++++
  673.  
  674. >From KNEworley@aol.com (Kenneth Worley)
  675. Date: Wed, 14 Feb 1996 09:12:21 -0700
  676. Organization: The Computer Den, Inc. Evanston WY
  677.  
  678. In article <chad-0602960305420001@sverige.pengar.com>, chad@pengar.com
  679. (Chad Leigh @ The Electronic GunShop) wrote:
  680.  
  681. > 1.  Is it necessary to do a SetGWorld to the *destination*
  682. > Gworld/CGrafport before doing the CopyBits?     NIM:ImagQDraw (IQD) seems
  683. > to imply that you need to do this. (at least for the window).  Looking at
  684. > the examples in NIM:IQD they do this.  But after having troubles on the
  685. > IIsi, and then looking at example code, like in the "Tricks of the Mac
  686. > Game Programming Gurus", they do lots of CopyBits without ever Setting any
  687. > port (equivalent) that I could tell.  Looking at various example in
  688. > different places, some do it and some don't.
  689. > After setting the gworld (SetGWorld) my code now works on the IIsi (it
  690. > always worked on the PPC).  (I do some simple animations as pieces move on
  691. > a field and the piece on the PPC would move nicely in a slide to its next
  692. > position -- on the IIsi it would hesitate for a second and then jump to
  693. > its new position. (The hesitation was the "sliding" loop but it didn't
  694. > show up on the screen.  Now it all works on both machines).
  695.  
  696. Looks like you answered your own question. I always understood that you do,
  697. in fact, have to set the destination port before doing a CopyBits. In fact,
  698. the destination port's fore and background colors affect the CopyBits
  699. operation.
  700.  
  701. > 2.  LockPixels() -- NIM says that you need to do this before doing a
  702. > CopyBits into or from a GWorld (NIM:IQD 6-9 -- 4th paragraph down).  Lots
  703. > of examples don't.  I always have but after seeing others not I am
  704. > wondering?
  705. > Is setting the NoPurge (default) flag in the NewGWorld call enough to not
  706. > have to do this?  I ask because NIM:IQD does NOT make this qualification
  707. > and also because maybe there is a technical difference between "purging
  708. > (out of memory)" and merely "moving" the base address.
  709.  
  710. NoPurge just keeps the relocatable block from being let go. It doesn't do
  711. anything to actually lock the BitMap in place. Even though CopyBits will
  712. work a lot of times when you don't lock the pixels, there are always a
  713. few circumstances where it won't. I always understood though that you only
  714. need to lock the pixels of the GWorld you're copying FROM. Anyone else know
  715. if that's correct or not?
  716.  
  717. - ---------------------------------------------------
  718.   Kenneth Worley
  719.   KNEworley@aol.com
  720. - ---------------------------------------------------
  721.  
  722. ---------------------------
  723.  
  724. >From lockheimer@twics.com (Hiroshi Lockheimer)
  725. Subject: Drag & Drop and Trash
  726. Date: Sun, 04 Feb 1996 05:18:34 +0900
  727. Organization: Twics Co. Ltd., Japan
  728.  
  729. Hi all:
  730.  
  731. I'm wondering if there's any code on how to determine if something has
  732. been dragged into the trash.  
  733.  
  734. Basically, I want the user to be able to drag some list items (as in the
  735. List Manager) around, and if the user wants to delete the item, dropping
  736. it into the trash would do the job (Anarchie and Netscape both do this).
  737.  
  738. So far I have it working by installing a custom DragSendProc and
  739. determining inside this proc (via GetDropLocation, etc.) if the user
  740. dragged into the trash and if so, deleting the current selection from my
  741. list.  HOWEVER, I can't for the life of me figure out how to get the Drag
  742. Manager _not_ to do the "zoom" effect back from the trash to where the
  743. deleted item used to be.  
  744.  
  745. Do I have to write a custom drawing proc to bypass the "zoom"?  Any hints?
  746.  
  747. TIA,
  748. Hiroshi Lockheimer
  749.  
  750. +++++++++++++++++++++++++++
  751.  
  752. >From Carl R. Osterwald <carl_osterwald@nrel.gov>
  753. Date: 7 Feb 1996 16:51:11 GMT
  754. Organization: National Renewable Energy Laboratory
  755.  
  756. In article <lockheimer-0402960518340001@b16.dial.twics.com> Hiroshi
  757. Lockheimer, lockheimer@twics.com writes:
  758.  
  759. >I'm wondering if there's any code on how to determine if something has
  760. >been dragged into the trash.  
  761.  
  762. Here's a bit of code that I use:
  763.  
  764. Boolean drop_pos_is_trash (DragReference drag_ref)
  765. {
  766.   Boolean   result = false;
  767.   Boolean   changed;
  768.   AEDesc    drop_location;
  769.   AliasHandle  drop_alias;
  770.   FSSpec    drop_file_spec;
  771.   FSSpec    trash_file_spec;
  772.   short     trash_vRefNum;
  773.   long      trash_dirID;
  774.     
  775.   if ( GetDropLocation(drag_ref, &drop_location) == noErr )
  776.     {
  777.       drop_alias = (AliasHandle)drop_location.dataHandle;
  778.       if (
  779.          drop_location.descriptorType == typeAlias &&
  780.          ResolveAlias( nil,
  781.                        drop_alias,
  782.                        &drop_file_spec,
  783.                        &changed) == noErr &&
  784.          FindFolder( kOnSystemDisk,
  785.                      kTrashFolderType,
  786.                      kDontCreateFolder,
  787.                      &trash_vRefNum,
  788.                      &trash_dirID) == noErr &&
  789.          FSMakeFSSpec( trash_vRefNum,
  790.                       trash_dirID,
  791.                       nil,
  792.                       &trash_file_spec) == noErr &&
  793.          equal_file_specs(&trash_file_spec, &drop_file_spec)
  794.          )
  795.              result = true;
  796.       AEDisposeDesc(&drop_location);
  797.     }
  798.   return(result);
  799. }
  800.  
  801. Boolean equal_file_specs (FSSpec *file1, FSSpec *file2)
  802. {
  803.   return
  804.     IUEqualString(file1->name, file2->name) == 0 &&
  805.     file1->vRefNum == file2->vRefNum &&
  806.     file1->parID == file2->parID;
  807. }
  808.  
  809. +++++++++++++++++++++++++++
  810.  
  811. >From gurgle@dnai.com (Pete Gontier)
  812. Date: Sat, 10 Feb 1996 12:57:47 -0800
  813. Organization: Cellular
  814.  
  815. In article <lockheimer-0402960518340001@b16.dial.twics.com>, 
  816. lockheimer@twics.com (Hiroshi Lockheimer) wrote:
  817.  
  818.  > I'm wondering if there's any code on how to determine if something has
  819.  > been dragged into the trash.  
  820.  > So far I have it working by installing a custom DragSendProc and
  821.  > determining inside this proc (via GetDropLocation, etc.) if the user
  822.  > dragged into the trash and if so, deleting the current selection from my
  823.  > list.  HOWEVER, I can't for the life of me figure out how to get the Drag
  824.  > Manager _not_ to do the "zoom" effect back from the trash to where the
  825.  > deleted item used to be.  
  826.  
  827. Add data to your drag item of type 'promiseHFS'. (I don't have headers
  828. lying around at the moment, so you'll have to search in <Drag.h> for that
  829. sub-string to get the real constant.) Implement the whole ritual for that
  830. data flavor as documented in Drag Manager Programmer's Guide. You may or
  831. may not actually have to create a file in the trash to satisfy Finder and
  832. Drag Manager that you've done the right thing. If you do have to create
  833. the file, simply delete it right after TrackDrag returns. (Its FSSpec will
  834. still be in the drag reference.)
  835.  
  836. NewsWatcher may or may not do it this way, but it's easy to check.
  837.  
  838. - -----------------------------
  839.  
  840.   Pete Gontier -- Apple Macintosh Developer Technical Support
  841.   <URL:mailto:gurgle@dnai.com> -- <URL:http://www.dnai.com/~gurgle>
  842.  
  843. +++++++++++++++++++++++++++
  844.  
  845. >From ari@shore.net (Ari Halberstadt)
  846. Date: Sun, 11 Feb 1996 23:52:10 -0400
  847. Organization: Shore.Net/Eco Software, Inc; (info@shore.net)
  848.  
  849. In article <gurgle-1002961257470001@dynamic-223.dnai.com>, gurgle@dnai.com
  850. (Pete Gontier) wrote:
  851.  
  852. >In article <lockheimer-0402960518340001@b16.dial.twics.com>, 
  853. >lockheimer@twics.com (Hiroshi Lockheimer) wrote:
  854. >
  855. > > I'm wondering if there's any code on how to determine if something has
  856. > > been dragged into the trash.  
  857. > > So far I have it working by installing a custom DragSendProc and
  858. > > determining inside this proc (via GetDropLocation, etc.) if the user
  859. > > dragged into the trash and if so, deleting the current selection from my
  860. > > list.  HOWEVER, I can't for the life of me figure out how to get the Drag
  861. > > Manager _not_ to do the "zoom" effect back from the trash to where the
  862. > > deleted item used to be.  
  863. >
  864.  
  865. There's another way to detect a drag to trash. This is hacked out of some
  866. C code. I'm not sure about how to disable the zoom effect.
  867.  
  868. ...
  869.       /* track the drag */
  870.       err = TrackDrag(drag, &event, dragRgn);
  871.       if (err != dragNotAcceptedErr && err != userCanceledErr) {
  872.          ThrowIfOSError(err);
  873.          
  874.          /* delete the selection if it was dropped onto a
  875.             destination to which the selection should be
  876.             moved instead of copied (i.e., to the trash) */          
  877.          ThrowIfOSError(GetDragModifiers(drag, 0L, &mouseDownModifiers,
  878. &mouseUpModifiers));
  879.          if (  (mouseDownModifiers & optionKey) == 0 &&
  880.                (mouseUpModifiers & optionKey) == 0 &&
  881.                DragTargetIsTrash(drag))
  882.          {
  883.             // delete the selection
  884.          }
  885.  
  886.       }
  887. ...
  888.  
  889. /* Ã¼wsDragTargetIsTrash returns true if the target of the drag was the
  890.    trash.
  891.    
  892.    Adapted from "DragText", by Rob Johnston, part of the Drag Manager sample
  893.    code from Apple. */
  894. wstBoolean wsDragTargetIsTrash(DragReference drag)
  895. {
  896.    AEDesc      targetDesc;
  897.    AEDesc      targetDescSpec;
  898.    FSSpec      targetSpec;
  899.    CInfoPBRec  targetPB;
  900.    short       trashVRefNum;
  901.    long        trashDirID;
  902.    wstBoolean  trash;
  903.    
  904.    wsTry {
  905.       
  906.       /* Coerce the target descriptor to an FSSpec. If there's no target or it
  907.          can't be coerced into an FSSpec, then it couldn't have been the
  908. Trash. */
  909.       trash = false;
  910.       wsThrowIfOSError(GetDropLocation(drag, &targetDesc));
  911.       if (  targetDesc.descriptorType != typeNull &&
  912.             AECoerceDesc(&targetDesc, typeFSS, &targetDescSpec) == noErr)
  913.       {
  914.    
  915.          /* get the directory ID of the target */
  916.          targetSpec = *(FSSpec *) *targetDescSpec.dataHandle;
  917.          AEDisposeDesc(&targetDescSpec);
  918.          blkclr(&targetPB, sizeof(CInfoPBRec));
  919.          targetPB.dirInfo.ioNamePtr = targetSpec.name;
  920.          targetPB.dirInfo.ioVRefNum = targetSpec.vRefNum;
  921.          targetPB.dirInfo.ioDrDirID = targetSpec.parID;
  922.          ThrowIfOSError(PBGetCatInfoSync(&targetPB));
  923.    
  924.          /* get the location of the trash folder */
  925.          if (MacHasFindFolder()) {
  926.             ThrowIfOSError(FindFolder(targetSpec.vRefNum,
  927. kTrashFolderType, kCreateFolder,
  928.                &trashVRefNum, &trashDirID));
  929.    
  930.             /* check if the target is the trash folder */
  931.             trash = (targetPB.dirInfo.ioVRefNum == trashVRefNum &&
  932.                      targetPB.dirInfo.ioDrDirID == trashDirID);
  933.          }
  934.       }
  935.  
  936.    } wsAlways {
  937.       AEDisposeDesc(&targetDesc);
  938.    } wsEndTry;
  939.    return(trash);
  940. }
  941.  
  942. -- Ari Halberstadt (ari@shore.net, <http://www.shore.net/~ari/>)
  943. Computer consulting, specializing in Macintosh software development.
  944.  
  945. +++++++++++++++++++++++++++
  946.  
  947. >From gurgle@apple.com (Pete Gontier)
  948. Date: Tue, 13 Feb 1996 16:42:47 -0800
  949. Organization: Apple Computer, Inc.
  950.  
  951. In article <4fal9v$5lv@nrel.nrel.gov>,
  952. Carl R. Osterwald <carl_osterwald@nrel.gov> wrote:
  953.  
  954.  > In article <lockheimer-0402960518340001@b16.dial.twics.com> Hiroshi
  955.  > Lockheimer, lockheimer@twics.com writes:
  956.  > 
  957.  > >I'm wondering if there's any code on how to determine if something has
  958.  > >been dragged into the trash.  
  959.  > 
  960.  > Here's a bit of code that I use...
  961.  
  962. The sample looked OK except that it did not appear to handle the case of
  963. dropping into a folder which itself was in the trash. Copying to myself as
  964. a sample code idea.
  965.  
  966.   ---
  967.  
  968.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  969.  
  970.   work      mail  <mailto:gurgle@apple.com>
  971.   personal  mail  <mailto:gurgle@ccnet.com>
  972.   personal  web   <http://www.ccnet.com/~gurgle>
  973.   work      web   <http://dev.info.apple.com/dts.html>
  974.  
  975. +++++++++++++++++++++++++++
  976.  
  977. >From gurgle@apple.com (Pete Gontier)
  978. Date: Tue, 13 Feb 1996 18:06:45 -0800
  979. Organization: Apple Computer, Inc.
  980.  
  981. In article <lockheimer-0402960518340001@b16.dial.twics.com>, 
  982. lockheimer@twics.com (Hiroshi Lockheimer) wrote:
  983.  
  984.  > I'm wondering if there's any code on how to determine if something has
  985.  > been dragged into the trash.  
  986.  
  987. NewsWatcher does this (I just tested) and the source is available.
  988.  
  989.     <ftp://ftp.acns.nwu.edu//pub/newswatcher/source-212.sea.hqx>
  990.  
  991. Also:
  992.  
  993. Dev.CD Jan 96 SDK1
  994.   Development Kits (Disc 1)
  995.     Macintosh Drag and Drop
  996.       Demo Applications
  997.         FinderDrag
  998.  
  999.   ---
  1000.  
  1001.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  1002.  
  1003.   work      mail  <mailto:gurgle@apple.com>
  1004.   personal  mail  <mailto:gurgle@ccnet.com>
  1005.   personal  web   <http://www.ccnet.com/~gurgle>
  1006.   work      web   <http://dev.info.apple.com/dts.html>
  1007.  
  1008. ---------------------------
  1009.  
  1010. >From michel@ellis.fdn.org (Michel Pollet)
  1011. Subject: Drag Manager: How to have custom clippings
  1012. Date: Wed, 07 Feb 1996 17:00:22 +0100
  1013. Organization: SAT Euronis
  1014.  
  1015. I would like to have custom drag manager clippings for the finder, or, at
  1016. least, a custom icon for identifying them. for the moment, I add a PICT
  1017. representation of the object, but that's not very usefull for the end
  1018. user.
  1019.  
  1020. Has anybody done that ? does anybody knowns how to make custom views in
  1021. the finder like, say, CyberFinder, or Desktop printer ?
  1022.  
  1023. Please copy any answer by mail to michel@ellis.fdn.org, my newsfeed is a
  1024. little erratic.
  1025.  
  1026. Michel
  1027.  
  1028. -- 
  1029. Michel Pollet, Macintosh developer
  1030. Email: michel@ellis.fdn.org                Visio (H320) : (33) 144066328
  1031.  
  1032. +++++++++++++++++++++++++++
  1033.  
  1034. >From awiner@oracle.com (Adam Winer)
  1035. Date: Wed, 07 Feb 1996 17:04:32 -0800
  1036. Organization: Oracle Corporation
  1037.  
  1038. In article <michel-0702961700260001@194.98.3.103>, michel@ellis.fdn.org
  1039. (Michel Pollet) wrote:
  1040.  
  1041. > I would like to have custom drag manager clippings for the finder, or, at
  1042. > least, a custom icon for identifying them. for the moment, I add a PICT
  1043. > representation of the object, but that's not very usefull for the end
  1044. > user.
  1045. > Has anybody done that ? does anybody knowns how to make custom views in
  1046. > the finder like, say, CyberFinder, or Desktop printer ?
  1047.  
  1048. Save the clipping as an ordinary file.  To do this, you'll want to use
  1049. the "PromiseHFSFlavor" flavor type;  see the Drag Manager docs
  1050. for more info.  Also, see the GetDropLocation() function;  it'll let
  1051. you find where the file was dragged.
  1052.  
  1053. -- Adam Winer
  1054. awiner@us.oracle.com
  1055.  
  1056. +++++++++++++++++++++++++++
  1057.  
  1058. >From gurgle@apple.com (Pete Gontier)
  1059. Date: Wed, 14 Feb 1996 14:19:14 -0800
  1060. Organization: Apple Computer, Inc.
  1061.  
  1062. In article <michel-0702961700260001@194.98.3.103>,
  1063. michel@ellis.fdn.org (Michel Pollet) wrote:
  1064.  
  1065.  > I would like to have custom drag manager clippings for the finder, or, at
  1066.  > least, a custom icon for identifying them. for the moment, I add a PICT
  1067.  > representation of the object, but that's not very usefull for the end
  1068.  > user.
  1069.  > 
  1070.  > Has anybody done that ? does anybody knowns how to make custom views in
  1071.  > the finder like, say, CyberFinder, or Desktop printer ?
  1072.  
  1073. It's not possible to write a clipping extension at the moment. It's a
  1074. shame, because I would certainly like to see more (jpeg, tiff, gif, rtf,
  1075. etc.).
  1076.  
  1077. The best you're going to be able to do, as another poster noted, is
  1078. 'flavorTypePromiseHFS', which allows you to create a regular document at
  1079. the drop target. There's a good sample of how this works in the Drag and
  1080. Drop SDK:
  1081.  
  1082.     <ftp://ftp.info.apple.com/Apple.Support.Area/Developer_Services/
  1083.         Development_Kits/Macintosh_Drag_-_Drop/
  1084.             Macintosh_Drag_and_Drop.sit.hqx
  1085.  
  1086. You developer programs folk can go right to the sample without downloading
  1087. the whole SDK:
  1088.  
  1089. Dev.CD Jan 96 SDK1
  1090.   Development Kits (Disc 1)
  1091.     Macintosh Drag and Drop
  1092.       Demo Applications
  1093.         FinderDrag
  1094.  
  1095. I imagine the NewsWatcher source code demonstrates this well, too.
  1096.  
  1097.     <ftp://ftp.acns.nwu.edu//pub/newswatcher/source-212.sea.hqx>
  1098.  
  1099.   ---
  1100.  
  1101.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  1102.  
  1103.   work      mail  <mailto:gurgle@apple.com>
  1104.   personal  mail  <mailto:gurgle@ccnet.com>
  1105.   personal  web   <http://www.ccnet.com/~gurgle>
  1106.   work      web   <http://dev.info.apple.com/dts.html>
  1107.  
  1108. ---------------------------
  1109.  
  1110. >From jhoos@orion.math.uiuc.edu (Jason Hoos)
  1111. Subject: Idle time
  1112. Date: 8 Feb 1996 07:42:31 GMT
  1113. Organization: University of Illinois at Urbana
  1114.  
  1115. Is there some simple way to tell from within C how long a Mac has
  1116. been idle for?  If not, what's the complicated way? :)
  1117.  
  1118. -- 
  1119.      /============/       Jason Hoos - jhoos@uiuc.edu       \============\
  1120.     /============/   USA-CERL Graduate Database Developer    \============\ 
  1121.    /============/   Math Department System Co-Administrator   \============\
  1122.   /============/   University of Illinois - Urbana-Champaign   \============\
  1123.  
  1124. +++++++++++++++++++++++++++
  1125.  
  1126. >From phixus@deltanet.com (Chris De Salvo)
  1127. Date: Fri, 09 Feb 1996 04:23:01 -0800
  1128. Organization: MacPlay
  1129.  
  1130. In article <4fc9h7$mbb@vixen.cso.uiuc.edu>, jhoos@orion.math.uiuc.edu
  1131. (Jason Hoos) wrote:
  1132.  
  1133. >Is there some simple way to tell from within C how long a Mac has
  1134. >been idle for?  If not, what's the complicated way? :)
  1135.  
  1136. If you define "idle" as having no mouse or keyboard activity then it's
  1137. pretty easy.  Each time through your event loop just record the mouse
  1138. position.  If it's the same as last time, the mouse hasn't moved.  Easiest
  1139. way I've found for checking keyboard activity is to use GetKeys() and then
  1140. just memcmp() each new result to the last time.
  1141.  
  1142. If you want to go further and check for disk/network activity, etc., then
  1143. I have no clue.
  1144.  
  1145. L8R
  1146. Chris
  1147.  
  1148. -- 
  1149. phixus@deltanet.com         |   Macintosh:  Changing the world,
  1150. Chris De Salvo              |        one person at a time!
  1151. Professional Mac Geek       |    -----------------------------
  1152. for MacPlay, Inc.           |      (I wish they'd hurry up!)
  1153.  
  1154.            http://www.deltanet.com/users/phixus
  1155.  
  1156. +++++++++++++++++++++++++++
  1157.  
  1158. >From hvoth@cln.etc.bc.ca
  1159. Date: Tue, 13 Feb 1996 09:30:27 GMT
  1160. Organization: Education Technology Centre of B.C.
  1161.  
  1162. In article <phixus-0902960423010001@ana0012.deltanet.com>,
  1163. phixus@deltanet.com (Chris De Salvo) wrote:
  1164.  
  1165. > In article <4fc9h7$mbb@vixen.cso.uiuc.edu>, jhoos@orion.math.uiuc.edu
  1166. > (Jason Hoos) wrote:
  1167. > >Is there some simple way to tell from within C how long a Mac has
  1168. > >been idle for?  If not, what's the complicated way? :)
  1169. > If you define "idle" as having no mouse or keyboard activity then it's
  1170. > pretty easy.  Each time through your event loop just record the mouse
  1171. > position.  If it's the same as last time, the mouse hasn't moved.  Easiest
  1172. > way I've found for checking keyboard activity is to use GetKeys() and then
  1173. > just memcmp() each new result to the last time.
  1174. > If you want to go further and check for disk/network activity, etc., then
  1175. > I have no clue.
  1176.  
  1177. Use a jGNE filter INIT. Check for mouse location (as suggested above) and
  1178. for keydown events. If you want modifier keys, then you need to use
  1179. GetKeys.
  1180.  
  1181. I check for mouse location on idle events.
  1182.  
  1183. Just keep a "lastActivity" variable around and update it each time through.
  1184.  
  1185. For more help with jGNE filters, check for the various snippets and the
  1186. project called "jGNE Helper" in the archives about the Internet.
  1187.  
  1188. -Randall
  1189. --hvoth@cln.etc.bc.ca
  1190.  
  1191. +++++++++++++++++++++++++++
  1192.  
  1193. >From gurgle@apple.com (Pete Gontier)
  1194. Date: Tue, 13 Feb 1996 15:50:50 -0800
  1195. Organization: Apple Computer, Inc.
  1196.  
  1197. In article <4fc9h7$mbb@vixen.cso.uiuc.edu>,
  1198. jhoos@orion.math.uiuc.edu (Jason Hoos) wrote:
  1199.  
  1200.  > Is there some simple way to tell from within C how long a Mac has
  1201.  > been idle for?
  1202.  
  1203. No. That was easy. :-)
  1204.  
  1205.  > If not, what's the complicated way? :)
  1206.  
  1207. I recommend something based on jGNEFilter. See my personal web pages for a
  1208. sample. The tricky part is defining "idle". If the Mac is sorting a large
  1209. database over a network (a lengthy, slow operation) and the user goes away
  1210. to get coffee, how do you know? Patch File Manager? Ugh. There are
  1211. probably 100 other cases to handle, too.
  1212.  
  1213. You haven't mentioned why you need to know this, but one way to leverage
  1214. somebody else's work is to write an AfterDark module.
  1215.  
  1216. - ---------
  1217.  
  1218.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  1219.  
  1220.   work      mail  <mailto:gurgle@apple.com>
  1221.   personal  mail  <mailto:gurgle@ccnet.com>
  1222.   personal  web   <http://www.ccnet.com/~gurgle>
  1223.   work      web   <http://dev.info.apple.com/dts.html>
  1224.  
  1225. ---------------------------
  1226.  
  1227. >From marka@ee470.ee.mcgill.ca (Mark Aran Aiken)
  1228. Subject: KanjiTalk ignores GNEFilters?
  1229. Date: 1 Feb 1996 08:09:25 GMT
  1230. Organization: McGill University, Undergraduate EE Lab
  1231.  
  1232. Hello all,
  1233.  
  1234.     I'm collaborating with this guy to localize a shareware app of
  1235. mine to Japanese, and I noticed something very disconcerting.
  1236.  
  1237.     When running under KanjiTalk 7.5.2, if one is using a Japanese
  1238. script, a jGNEFilter I install never gets to see keystrokes. If an app
  1239. calls WNE, they get handed a keyDown event, but the System seems to
  1240. manufacture it from the intermediate input window without posting it
  1241. to the event queue.
  1242.  
  1243.     Can someone else confirm this? IM:Text (Which talks about the Text
  1244. Services) doesn't mention this, but then again, I haven't been able to
  1245. find jGNEFilters mentioned officially in any of the IM volumes.
  1246.  
  1247.     Am I stuck patching WNE and peeking at the results the app is
  1248. about to get for KanjiTalk?
  1249.  
  1250.     Mark
  1251.  
  1252. --
  1253.  
  1254.  -----------------------------------------------------------------------------
  1255. | Mark A. Aiken                          Macintosh wizard and shareware author|
  1256. | Undergrad, EE, McGill U, Mtl, CANADA   marka@kagi.com / marka@ee.mcgill.ca  |
  1257. | WWW site of Macintosh shareware at     http://www.kagi.com/authors/marka    |
  1258. | General WWW home page at               http://www.ee.mcgill.ca/~marka       |
  1259.  -----------------------------------------------------------------------------
  1260.  
  1261. +++++++++++++++++++++++++++
  1262.  
  1263. >From gurgle@dnai.com (Pete Gontier)
  1264. Date: Sat, 03 Feb 1996 12:39:05 -0800
  1265. Organization: Cellular
  1266.  
  1267. In article <4epsfl$m3g@sifon.cc.mcgill.ca>,
  1268. marka@ee470.ee.mcgill.ca (Mark Aran Aiken) wrote:
  1269.  
  1270.  > I haven't been able to
  1271.  > find jGNEFilters mentioned officially in any of the IM volumes.
  1272.  
  1273. It's documented in IM I very very briefly and also:
  1274.  
  1275.     <URL:http://dev.info.apple.com/technotes/
  1276.         Archive/Toolbox/tb_11.html>
  1277.  
  1278.  > Am I stuck patching WNE and peeking at the results the app is
  1279.  > about to get for KanjiTalk?
  1280.  
  1281. I'm not familiar with any KanjiTalk problem. Copying this to myself for
  1282. bug report searching when I get back to work.
  1283.  
  1284. - -----------------------------
  1285.  
  1286.   Pete Gontier -- Apple Macintosh Developer Technical Support
  1287.   <URL:mailto:gurgle@dnai.com> -- <URL:http://www.dnai.com/~gurgle>
  1288.  
  1289. +++++++++++++++++++++++++++
  1290.  
  1291. >From Matt Slot <fprefect@umich.edu>
  1292. Date: 5 Feb 1996 05:42:11 GMT
  1293. Organization: University of Michigan
  1294.  
  1295. Mark Aran Aiken, marka@ee470.ee.mcgill.ca writes:
  1296.  > When running under KanjiTalk 7.5.2, if one is using a Japanese
  1297.  > script, a jGNEFilter I install never gets to see keystrokes.
  1298.  
  1299. WorldScript bypasses the jGNE mechanism when reporting "keystrokes", since
  1300. keyboard input is often emulated by Inline Input windows. This means that
  1301. systems since 7.1 are susceptible... and patching _GetNextEvent may be your
  1302. only option. (WNE calls GNE, but recall that GNE is reentrant across 
  1303. contexts.)
  1304.  
  1305.  
  1306. Pete Gontier, gurgle@dnai.com writes:
  1307.  > I'm not familiar with any KanjiTalk problem. Copying this to myself for
  1308.  > bug report searching when I get back to work.
  1309.  
  1310. I don't know if/where this is documented, but it certainly has been around
  1311. for a while. With the "tenative" future of the jGNE mechanism, I don't think
  1312. there are plans to fix the problems with it.
  1313.  
  1314. Besides, the "missing clicks" bug has been around since 7.0, and no one is
  1315. rushing to fix (or document) that.
  1316.  
  1317. Matt
  1318. (not as bitter as he sounds...)
  1319.  
  1320. * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
  1321. *  Reality: Matt Slot                             *  Time is an illusion.
  1322. *  E-Mail:  mailto:fprefect@umich.edu             *  Lunchtime doubly so.
  1323. *  Web:     http://www.sils.umich.edu/~fprefect/  *     -- Douglas Adams
  1324. * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
  1325.  
  1326. +++++++++++++++++++++++++++
  1327.  
  1328. >From gurgle@apple.com (Pete Gontier)
  1329. Date: Tue, 13 Feb 1996 18:00:57 -0800
  1330. Organization: Apple Computer, Inc.
  1331.  
  1332. In article <4f45bj$4mh@srvr1.engin.umich.edu>,
  1333. Matt Slot <fprefect@umich.edu> wrote:
  1334.  
  1335.  > Pete Gontier, gurgle@dnai.com writes:
  1336.  >  > I'm not familiar with any KanjiTalk problem. Copying this to myself for
  1337.  >  > bug report searching when I get back to work.
  1338.  > 
  1339.  > I don't know if/where this is documented, but it certainly has been around
  1340.  > for a while. With the "tenative" future of the jGNE mechanism, I don't think
  1341.  > there are plans to fix the problems with it.
  1342.  
  1343. Yep. I found a bug in the database, and it's still open.
  1344.  
  1345.   ---
  1346.  
  1347.   Pete Gontier, Integer Poet, Apple Macintosh Developer Technical Support
  1348.  
  1349.   work      mail  <mailto:gurgle@apple.com>
  1350.   personal  mail  <mailto:gurgle@ccnet.com>
  1351.   personal  web   <http://www.ccnet.com/~gurgle>
  1352.   work      web   <http://dev.info.apple.com/dts.html>
  1353.  
  1354. ---------------------------
  1355.  
  1356. >From "Patrick C. Beard" <beard@basilsoft.com>
  1357. Subject: [ANN] GC 4.9 for MacOS
  1358. Date: 14 Feb 1996 19:27:07 GMT
  1359. Organization: BasilSoft
  1360.  
  1361. The MacOS port of Version 4.9 of the Boehm-Demers-Weiser conservative 
  1362. garbage collector for C and C++, is now available. This collector is 
  1363. compatible with Symantec's THINK C/C++ (68K only), as well as 
  1364. Metrowerks CW8 (68K & PowerPC).
  1365.  
  1366. This version no longer requires the use of datastart.c and dataend.c. 
  1367. The collector now uses linker generated variables to locate global 
  1368. data. There is also limited support for using the collector with shared 
  1369. libraries.
  1370.  
  1371. Version 4.9 also contains miscellaneous bug fixes in the OS independent 
  1372. portions of the collector.
  1373.  
  1374. The new version is available at:
  1375.  
  1376. ftp://ftp.bdt.com/home/beard/gc/gc-4.9.sit.hqx
  1377.  
  1378.  
  1379.  
  1380.  
  1381. ---------------------------
  1382.  
  1383. >From smmcdowe@undergrad.math.uwaterloo.ca (Sean McDowell)
  1384. Subject: [ANN] Visit Mac Games Programmers' Bitstop!
  1385. Date: Tue, 13 Feb 1996 03:58:51 GMT
  1386. Organization: University of Waterloo
  1387.  
  1388. I'd like to welcome you all over to my little corner of the Web, the Mac 
  1389. Games Programmers' Bitstop. It's an organized, annotated list of internet 
  1390. resources for us Mac games programmers. 
  1391.  
  1392. I've added a few nifty sites, more will come when midterms are over :-(.
  1393. Drop me a note if you have any comments (it's lonely out here!) and enjoy 
  1394. your visit: http://www.undergrad.math.uwaterloo.ca/~smmcdowe/Bitstop.html.
  1395.  
  1396. Sean
  1397. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1398. Sean McDowell                  "We should not let ourselves be burnt for
  1399. University of Waterloo          our opinions: we are not that sure of them.
  1400. http://www.undergrad.math.      But perhaps for this: that we may have and
  1401. uwaterloo.ca/~smmcdowe          change our opinions." -- Nietzsche
  1402.  
  1403. ---------------------------
  1404.  
  1405. End of C.S.M.P. Digest
  1406. **********************
  1407.